#include "stdafx.h"
#include "LoggerWriter.h"


CLoggerWriter::CLoggerWriter()
{
}


CLoggerWriter::~CLoggerWriter()
{
}

CLoggerWriter* CLoggerWriter::GetInstance()
{
	static CLoggerWriter g_logwriter;
	return &g_logwriter;
}

void CLoggerWriter::Write(const char* szMessage)
{
	size_t len = strlen(szMessage);
	char* str = new char[len + 1];
	memset(str, 0, len + 1);
	strcpy(str, szMessage);
	::PostMessage(AfxGetMainWnd()->GetSafeHwnd(), WM_UPDATE_LOG_MESSAGE, (WPARAM)str, 0);

}